/**
 * 
 */
package ch.comtools.servermanager.ssh.ui.editor;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor;

import ch.comtools.servermanager.ssh.core.SessionInfo;
import ch.comtools.servermanager.ssh.ui.editor.page.TerminalFormPage;

/**
 * @author Roger Dudler <roger.dudler@gmail.com>
 * @version $Id$
 */
public class TerminalEditor extends FormEditor {

	private final static String PAGE_TERMINAL = "terminal";
	private TerminalFormPage pageTerminal;
	
	/* (non-Javadoc)
	 * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
	 */
	@Override
	protected void addPages() {
		pageTerminal = new TerminalFormPage(this, PAGE_TERMINAL, this.getPartName());
		try {
			this.addPage(pageTerminal);
		} catch (PartInitException e) {
			e.printStackTrace();
		}
	}
	
	@Override
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
		this.setSite(site);
		this.setInput(input);
		this.setPartName(input.getName());
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
	 */
	@Override
	public void doSave(IProgressMonitor monitor) {

	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
	 */
	@Override
	public void doSaveAs() {

	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
	 */
	@Override
	public boolean isSaveAsAllowed() {
		return false;
	}
	
	/**
	 * @param info
	 */
	public void setSessionInfo(final SessionInfo info) {
		pageTerminal.setSessionInfo(info);
	}
	
	@Override
	public void setFocus() {
		super.setFocus();
		this.pageTerminal.setFocus();
	}
	
}
